﻿<%@ Page Title="Adjustments" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Adjustments.aspx.cs" Inherits="TestJQGrid.Adjustments" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="Trirand.Web" Namespace="Trirand.Web.UI.WebControls" TagPrefix="Trirand" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <!-- The jQuery UI theme that will be used by the grid -->
    <link rel="stylesheet" type="text/css" media="screen" href="/themes/redmond/jquery-ui-1.8.2.custom.css" />
    <!-- The jQuery UI theme extension jqGrid needs -->
    <link rel="stylesheet" type="text/css" media="screen" href="/themes/ui.jqgrid.css" />
    <!-- jQuery runtime minified -->
    <script src="/js/jquery-1.4.4.min.js" type="text/javascript"></script>
    <!-- The localization file we need, English in this case -->
    <script src="/js/trirand/i18n/grid.locale-en.js" type="text/javascript"></script>
    <!-- The jqGrid client-side javascript -->
    <script src="/js/trirand/jquery.jqGrid.min.js" type="text/javascript"></script>
    <script src="/js/trirand/jquery.jqDatePicker.min.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table border="1px" width="100%">
        <tr>
            <td align="left" style="height: 80%; width: 80%;" valign="top">
                <Trirand:JQGrid runat="server" ID="JQGrid1" Height="300px" Width="700px" OnRowDeleting="JQGrid1_RowDeleting"
                    OnRowEditing="JQGrid1_RowEditing" AutoWidth="true">
                    <Columns>
                        <Trirand:JQGridColumn DataField="TransId" PrimaryKey="True" />
                        <Trirand:JQGridColumn DataField="EntryStatus" />
                        <Trirand:JQGridColumn DataField="AgentId" Editable="true" EditType="DropDown" EditorControlID="DDLAgent" />
                        <Trirand:JQGridColumn DataField="TransDate" Editable="true" DataType="System.DateTime"
                            DataFormatString="{0:dd/MM/yyyy}" EditType="DatePicker" EditorControlID="datepicker" />
                        <Trirand:JQGridColumn DataField="CarValue" />
                        <Trirand:JQGridColumn DataField="CityCode" />
                        <Trirand:JQGridColumn DataField="Model" Editable="true" EditType="DropDown" EditorControlID="DDLModel" />
                        <Trirand:JQGridColumn DataField="Manufacturer" Editable="true" EditType="DropDown"
                            EditorControlID="DDLManu" />
                        <Trirand:JQGridColumn DataField="Scheme" Editable="true" EditType="DropDown" EditorControlID="DDLScheme" />
                        <Trirand:JQGridColumn DataField="Description" />
                        <Trirand:JQGridColumn DataField="IntRate" />
                        <Trirand:JQGridColumn DataField="CarType" />
                        <Trirand:JQGridColumn DataField="LoanAmount" Editable="true" />
                    </Columns>
                    <ToolBarSettings ShowEditButton="true" ShowDeleteButton="true" ShowRefreshButton="True"
                        ShowSearchButton="True" ShowViewRowDetailsButton="True" />
                    <EditDialogSettings CloseAfterEditing="True" />
                    <SearchDialogSettings MultipleSearch="true" />
                    <SortSettings InitialSortColumn="TransId"></SortSettings>
                    <AppearanceSettings ShrinkToFit="false" />
                </Trirand:JQGrid>
                <Trirand:JQDatePicker ID="datepicker" runat="server" DateFormat="dd/MM/yyyy" DisplayMode="ControlEditor" />
                <asp:DropDownList ID="DDLModel" runat="server" DataSourceID="SDSModel" DataTextField="Model"
                    DataValueField="Model" AutoPostBack="True">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SDSModel" runat="server" ConnectionString="<%$ ConnectionStrings:AgentBillingConnectionString %>"
                    SelectCommand="SELECT [Model], [Manufacturer] FROM [ModelManufacturer]"></asp:SqlDataSource>
                <asp:DropDownList ID="DDLManu" runat="server" DataSourceID="SDSManu" DataTextField="Manufacturer"
                    DataValueField="Manufacturer">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SDSManu" runat="server" ConnectionString="<%$ ConnectionStrings:AgentBillingConnectionString %>"
                    SelectCommand="SELECT [Manufacturer] FROM [ModelManufacturer] WHERE ([Model] = @Model)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="DDLModel" Name="Model" PropertyName="SelectedValue"
                            Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:DropDownList ID="DDLScheme" runat="server" DataSourceID="SDSScheme" DataTextField="SchemeName"
                    DataValueField="SchemeName">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SDSScheme" runat="server" ConnectionString="<%$ ConnectionStrings:AgentBillingConnectionString %>"
                    SelectCommand="SELECT [SchemeName] FROM [Schemes] WHERE ([ProductName] = @ProductName)">
                    <SelectParameters>
                        <asp:SessionParameter DefaultValue="CarSales" Name="ProductName" SessionField="ProductName"
                            Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:DropDownList ID="DDLAgent" runat="server" DataSourceID="SDSAgent" DataTextField="AgentId"
                    DataValueField="AgentId">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SDSAgent" runat="server" ConnectionString="<%$ ConnectionStrings:AgentBillingConnectionString %>"
                    SelectCommand="SELECT [AgentId], [AgentName] FROM [Agents] WHERE ([ProductName] = @ProductName)">
                    <SelectParameters>
                        <asp:SessionParameter DefaultValue="CarSales" Name="ProductName" SessionField="ProductName"
                            Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr align="center" valign="middle">
            <td>
                <asp:Button ID="BApply" runat="server" Text="Apply" OnClick="BApply_Click" />
                <asp:Button ID="BCancel" runat="server" Text="Cancel" OnClick="BCancel_Click" />
            </td>
        </tr>
    </table>
</asp:Content>
